package com.dayu.recovery.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import com.dayu.common.annotation.Excel;
import com.dayu.common.core.domain.BaseEntity;

/**
 * 回收管理对象 recovery_collect
 *
 * @author HK
 * @date 2021-04-16
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class RecoveryCollect extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 收货编号 */
    private Long collectId;

    /** 收货来源 */
    private Integer collectSource;

    /** 供应商 */
    private Long sourceId;

    @Excel(name = "供应商")
    private String sourceName;

    @Excel(name = "回收订单号")
    private String orderId;

    /** 收货数量 */
    @Excel(name = "收货数量")
    private Integer collectNum;

    /** 价格组 */
    @Excel(name = "价格组")
    private String collectPrice;

    /** 快递单号 */
    @Excel(name = "快递单号")
    private String collectExpress;

    /** 状态 */
    @Excel(name = "状态", readConverterExp = "1=待生成,2=已生成")
    private Integer status;

    /** 创建人编号 */
    private Long createId;

    @Excel(name = "创建人")
    private String createName;


    private String offerName;

    @Excel(name = "绿色回收", readConverterExp = "y=是,n=否")
    private String hasGreen;

    /** 回收编号组 */
    private String storeIds;

    public Long[] getStoreIdsInLong() {
        if(StringUtils.isEmpty(storeIds)) {
            return null;
        }
        String str = storeIds.substring(1, storeIds.length() - 1);
        String[] arr = str.split(",");
        Long[] arrLong = new Long[arr.length];
        for(int i = 0; i < arr.length; i++) {
            arrLong[i] = Long.parseLong(arr[i]);
        }
        return arrLong;
    }
}
